Skip to content

Fixed private gateway can't be deleted#4016

Merged
yadvr merged 3 commits intoapache:4.13from
shapeblue:private-gateway-cant-be-deleted
Aug 12, 2020
Merged

Fixed private gateway can't be deleted#4016
yadvr merged 3 commits intoapache:4.13from
shapeblue:private-gateway-cant-be-deleted

Conversation

@Spaceman1984
Copy link
Contributor

@Spaceman1984 Spaceman1984 commented Apr 6, 2020

Description

When the static route service is not available on the VPC and a static route is created, the static route is created in a revoked state.

Currently, the UI doesn't distinguish between active or revoked static routes.

This PR adds the missing state filter to the list routes command and only lists active routes in the UI.
It also ignores revoked routes when the private gateway is being removed but clears out the inactive routes before the gateway is removed.

Fixes #2908

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Screenshots (if appropriate):

How Has This Been Tested?

This has been tested by creating a VPC with no services, adding a private gateway, adding a static route and deleting the gateway.

@Spaceman1984 Spaceman1984 changed the base branch from master to 4.13 April 6, 2020 09:33
@Spaceman1984
Copy link
Contributor Author

@blueorangutan package

Copy link
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Spaceman1984
In the case as you said "When the static route service is not available on the VPC when a static route is created, the static route is created in a revoked state", could you add some changes to avoid it ?

@Spaceman1984
Copy link
Contributor Author

Spaceman1984 commented Apr 6, 2020

In the case as you said "When the static route service is not available on the VPC when a static route is created, the static route is created in a revoked state", could you add some changes to avoid it ?

@weizhouapache The state of the route is changed to revoked after failing validation. The other option here would be to delete the record at this point, which I think was the intention, but the delete method is also failing validation. I thought to leave things this way, to keep some history until the gateway is removed. I'm happy to force delete the record after failing validation if you believe it's a better way to go?

@DaanHoogland
Copy link
Contributor

@blueorangutan package

@blueorangutan
Copy link

@DaanHoogland a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos7 ✔debian. JID-1145

@Spaceman1984 Spaceman1984 changed the title Fixed private gateway can't be deleted [WIP] Fixed private gateway can't be deleted Apr 7, 2020
@weizhouapache
Copy link
Member

In the case as you said "When the static route service is not available on the VPC when a static route is created, the static route is created in a revoked state", could you add some changes to avoid it ?

@weizhouapache The state of the route is changed to revoked after failing validation. The other option here would be to delete the record at this point, which I think was the intention, but the delete method is also failing validation. I thought to leave things this way, to keep some history until the gateway is removed. I'm happy to force delete the record after failing validation if you believe it's a better way to go?

@Spaceman1984 I think it would be better to remove the record if there is error/exception in the creation.

@Spaceman1984 Spaceman1984 changed the title [WIP] Fixed private gateway can't be deleted Fixed private gateway can't be deleted Apr 8, 2020
@Spaceman1984
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@Spaceman1984 a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos7 ✔debian. JID-1153

@Spaceman1984
Copy link
Contributor Author

In the case as you said "When the static route service is not available on the VPC when a static route is created, the static route is created in a revoked state", could you add some changes to avoid it ?

@weizhouapache The state of the route is changed to revoked after failing validation. The other option here would be to delete the record at this point, which I think was the intention, but the delete method is also failing validation. I thought to leave things this way, to keep some history until the gateway is removed. I'm happy to force delete the record after failing validation if you believe it's a better way to go?

@Spaceman1984 I think it would be better to remove the record if there is error/exception in the creation.

Done

@yadvr yadvr added this to the 4.13.2.0 milestone Jun 4, 2020
@yadvr
Copy link
Member

yadvr commented Jun 24, 2020

@Spaceman1984 this looks like deletes pg in CloudStack DB, have you verified if this would also cleanup rules on the VR properly?

@Spaceman1984
Copy link
Contributor Author

@Spaceman1984 this looks like deletes pg in CloudStack DB, have you verified if this would also cleanup rules on the VR properly?

No, I'll check.

@Spaceman1984
Copy link
Contributor Author

@Spaceman1984 this looks like deletes pg in CloudStack DB, have you verified if this would also cleanup rules on the VR properly?

@rhtyd I have checked iptables on the VR before and after trying to add a static route, there is no difference, also this code removes the static route, not the private gateway. Having broken static routes referencing the gateway prevented it from being deleted.

@yadvr
Copy link
Member

yadvr commented Jun 30, 2020

@Spaceman1984 private gateway would mean a nic, IP and route on the VR, not iptables rules

@yadvr
Copy link
Member

yadvr commented Jul 4, 2020

ping @Spaceman1984 no update?

@Spaceman1984 Spaceman1984 reopened this Jul 30, 2020
@Spaceman1984
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

@Spaceman1984 a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@yadvr
Copy link
Member

yadvr commented Aug 4, 2020

@Spaceman1984 ping, any update on this?

@Spaceman1984
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@Spaceman1984 a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result: ✔centos7 ✔debian. JID-1651

@Spaceman1984
Copy link
Contributor Author

@blueorangutan test

@blueorangutan
Copy link

@Spaceman1984 a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@Spaceman1984
Copy link
Contributor Author

@rhtyd I have tested creating and deleting a private gateway, the nic, ip and route is created and removed.

@DaanHoogland
Copy link
Contributor

@weizhouapache @rhtyd further doubts/questions or are we good to merge?

@borisstoyanov
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@borisstoyanov a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan
Copy link

Trillian test result (tid-2281)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 40627 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr4016-t2281-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_privategw_acl.py
Intermittent failure detected: /marvin/tests/smoke/test_routers_network_ops.py
Intermittent failure detected: /marvin/tests/smoke/test_vpc_vpn.py
Smoke tests completed. 76 look OK, 1 have error(s)
Only failed tests results shown below:

Test Result Time (s) Test File
test_02_vpc_privategw_static_routes Failure 212.97 test_privategw_acl.py
test_03_vpc_privategw_restart_vpc_cleanup Failure 207.71 test_privategw_acl.py
test_04_rvpc_privategw_static_routes Failure 316.80 test_privategw_acl.py

@yadvr
Copy link
Member

yadvr commented Aug 10, 2020

@DaanHoogland @Spaceman1984 - my concern is that whether removing privategateway also remove the nic/configuration from the VPC VR or not? Based on code, I think it will solve the issue or removing it from the DB. @Spaceman1984 did you test the case by adding privategateway with some static routes (also deploy VMs as VR programming is lazy) and check if VPC VR has a new nic and then removing it removes it both from VR and DB?

@Spaceman1984
Copy link
Contributor Author

Spaceman1984 commented Aug 11, 2020

@DaanHoogland @Spaceman1984 - my concern is that whether removing privategateway also remove the nic/configuration from the VPC VR or not? Based on code, I think it will solve the issue or removing it from the DB. @Spaceman1984 did you test the case by adding privategateway with some static routes (also deploy VMs as VR programming is lazy) and check if VPC VR has a new nic and then removing it removes it both from VR and DB?

@rhtyd I'll do some more testing

@Spaceman1984
Copy link
Contributor Author

@DaanHoogland @Spaceman1984 - my concern is that whether removing privategateway also remove the nic/configuration from the VPC VR or not? Based on code, I think it will solve the issue or removing it from the DB. @Spaceman1984 did you test the case by adding privategateway with some static routes (also deploy VMs as VR programming is lazy) and check if VPC VR has a new nic and then removing it removes it both from VR and DB?

@rhtyd I have confirmed that it works as expected.

@yadvr yadvr changed the base branch from 4.13 to 4.14 August 12, 2020 07:57
@yadvr yadvr closed this Aug 12, 2020
@yadvr yadvr reopened this Aug 12, 2020
gatewayid: args.context.vpcGateways[0].id,
listAll: true
listAll: true,
state: "Active"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Spaceman1984 can you send the related change to Primate as well cc @davidjumani

@yadvr yadvr changed the base branch from 4.14 to 4.13 August 12, 2020 07:58
@yadvr yadvr merged commit 86939e7 into apache:4.13 Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Private gateway can't be deleted

8 participants